<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-on事件绑定指令</title>
</head>
<body>
    <div id="app">
        {{msg}}
        <h2>年龄:{{age}}</h2>
        <button v-on:click="addAge">点击一下年龄加一</button>
        <button @click="subtractAge">点击一下年龄减一</button>
    </div>
</body>
</html>
<script src="./js/2.7.14_dist_vue.js"></script>
<script>
    new Vue({
       el:"#app",
       data:{
        msg:"Hello Vue!",
        age:20,
       } ,
       methods: {  //可以写很多种方法 //methods  用来定义vue中的方法
            //点击年龄+1
            addAge:function(){
                this.age++;
            },
            //点击年龄-1
            subtractAge:function(){
                this.age--;
            },
       },
    });
</script>